$(function(){
	AreaSelector().init();
	initEvent();
	initRentTypeEvent();
	initVechileTypeEvent();
	initLinkMan();
	initLinkPhone();
	initPriceEvent();
	initAddressEvent();
	initShopNameEvent();
	initEmailAndPass();
	fileUpload();
});

function fileUpload(){
	$("#fileupload").attr("data-url", "img.do?action=5&rentId=" + $("#hidId").val());
	
	$('#fileupload').fileupload({
		progressall: function (e, data) {
			meileLoading();
	    },
		acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,  
		dataType: 'text',
        done: function (e, data) {
        	removeMeileLoading();
        	var result = data.result;
        	if(result.indexOf("^") < 0){
        		layer.alert(result,2);
        		return;
        	}
        	$("#imageShow").show();
        	var imgUrl= result.split("^")[0];
        	var imgID = result.split("^")[1];
        	var oldImg = $("#imageShow").html();
    		var imgNum = $("#hidImgNum").val();
    		var num = parseInt(imgNum) + 1;
    		$("#hidImgNum").val(num);
    		if($('#imageShow').find('img').length > 6){
    			$("#fileupload").hide();
    			layer.alert("亲美美，已经上传了4张图片了，最多上传4张~~~",2);
    			
    		}
    		
            var img ="";
            var imgIds = $("#hidImgIds").val();
            if(imgIds == ""){
            	imgIds += imgID +"*home" + "^";
            	img = "<div id=\"img"+imgID.split("-")[1]+"\" style=\"float:left;width:100px;height:130px;margin-right:10px;\">" +
        		"<div style=\"width:100px;height:100px;float:left;position: relative;\">" +
        			"<img alt=\""+imgID+"\" src=\"" + imgUrl + "\" style=\"margin: 5px 5px 5px 5px;width:100px;height:100px;\"/>" +
        		"</div>" +
        		"<div style=\"width:100px;height:25px;float:left;position: relative;margin-top:8px;text-align:center;\">" +
            		"<img src=\"image/delete_img.jpg\" style=\"margin-left:5px;cursor:pointer;\" onclick=\"deleteImg('"+imgID+"');\"/>" +
            		"<img src=\"image/home_icon.png\" id=\"imgHome"+num+"\" style=\"margin-left:5px;cursor:auto;\" onclick=\"setHome('"+imgID+"','imgHome"+num+"' );\"/>" +
        		"</div>" +
    		"</div>";
            	
            	homeImageId = "imgHome"+num;
            }else{
            	imgIds += imgID + "^";
            	img = "<div id=\"img"+imgID.split("-")[1]+"\" style=\"float:left;width:100px;height:130px;margin-right:10px;\">" +
        		"<div style=\"width:100px;height:100px;float:left;position: relative;\">" +
        			"<img alt=\""+imgID+"\" src=\"" + imgUrl + "\" style=\"margin: 5px 5px 5px 5px;width:100px;height:100px;\"/>" +
        		"</div>" +
        		"<div style=\"width:100px;height:25px;float:left;position: relative;margin-top:8px;text-align:center;\">" +
            		"<img src=\"image/delete_img.jpg\" style=\"margin-left:5px;cursor:pointer;\" onclick=\"deleteImg('"+imgID+"');\"/>" +
            		"<img src=\"image/set_home.png\" id=\"imgHome"+num+"\" style=\"margin-left:5px;cursor:pointer;\" onclick=\"setHome('"+imgID+"','imgHome"+num+"' );\"/>" +
        		"</div>" +
    		"</div>";
            }
            
            $("#hidImgIds").val(imgIds);
            
            img += oldImg;
            $("#imageShow").html(img);
        }
	}	
	);
}

function initEmailAndPass(){
	$("#email").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请输入用户名/邮箱/手机号其中一种";
		$("#tipEmail").html(warnHmtl);
		$("#tipEmail").css("color", "#1c86ee");
		$("#email").css("border", "#ccc 1px solid");
	});
	
	
	$("#email").live("focusout", function(){
		var email = $("#email").val();
		if(email == ""){
			$("#email").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>用户名/邮箱/手机号不能为空";
			$("#tipEmail").html(warnHmtl);
			$("#tipEmail").css("color", "#f60");
		}else{
			$("#email").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tipEmail").html(warnHtmlOk);
		}
	});
	
	$("#passwordShow").live("focusout", function(){
		var email = $("#passwordShow").val();
		if(email == ""){
			$("#passwordShow").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>密码不能为空";
			$("#tippasswordShow").html(warnHmtl);
			$("#tippasswordShow").css("color", "#f60");
		}else{
			$("#passwordShow").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tippasswordShow").html(warnHtmlOk);
		}
	});
	
	$("#passwordShow").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请输入密码";
		$("#tippasswordShow").html(warnHmtl);
		$("#tippasswordShow").css("color", "#1c86ee");
		$("#passwordShow").css("border", "#ccc 1px solid");
	});
}

function initShopNameEvent(){
	$("#txtShopName").live("focusin",function(){
		$("#txtShopName").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请填写真实店铺名称（100个汉字以内）";
		$("#tipShopName").html(warnHmtl);
		$("#tipShopName").css("color", "#1c86ee");
	});
	
	$("#txtShopName").live("focusout",function(){
		var shop = $("#txtShopName").val();
		if(shop == ""){
			$("#txtShopName").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>店铺名称不能为空（100个汉字以内）";
			$("#tipShopName").html(warnHmtl);
			$("#tipShopName").css("color", "#f60");
		}else if(shop.length > 100){
			$("#txtShopName").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>店铺名称在100个汉字以内";
			$("#tipShopName").html(warnHmtl);
			$("#tipShopName").css("color", "#f60");
		}else{
			$("#txtShopName").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipShopName").html(warnHtmlOk);
		}
	});
}
function initAddressEvent(){
	$("#addressAttach").live("focusin", function(){
		$("#addressAttach").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>地址应该尽量详细";
		$("#tipShopAddr").html(warnHmtl);
		$("#tipShopAddr").css("color", "#1c86ee");
		var province = $("#sel_Province option:selected").text();
		if(province == "--省份--"){
			$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
			$("#tipShopAddr").html(warnHmtl);
			return false;
		}
		
		var city = $("#sel_City option:selected").text();
		if(city == "--城市--"){
			$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择城市";
			$("#tipShopAddr").html(warnHmtl);
			return false;
		}		
		
	});
	$("#addressAttach").live("focusout", function(){
		var addr = $("#addressAttach").val();
		if(addr == ""){
			$("#addressAttach").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>地址不能为空";
			$("#tipShopAddr").html(warnHmtl);
			$("#tipShopAddr").css("color", "#f60");
		}else if(addr.length > 200){
			$("#addressAttach").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>地址长度不能超过200个汉字";
			$("#tipShopAddr").html(warnHmtl);
			$("#tipShopAddr").css("color", "#f60");
		}else{
			$("#addressAttach").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipShopAddr").html(warnHtmlOk);
		}
	});
	
	$("#sel_Province").live("change",function(){
		var province = $("#sel_Province option:selected").text();
		if(province == "--省份--"){
			$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
			$("#tipShopAddr").html(warnHmtl);
		}else{
			$("#sel_Province").css("border", "#ccc 1px solid");
		}
	});
	
	$("#sel_City").live("change",function(){
		var city = $("#sel_City option:selected").text();
		if(city == "--省份--"){
			$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
			$("#tipShopAddr").html(warnHmtl);
		}else{
			$("#sel_City").css("border", "#ccc 1px solid");
		}
	});
}
function initPriceEvent(){
	$("#txtPrice").live("focusin",function(){
		$("#txtPrice").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>价格只能是数字";
		$("#tipPrice").html(warnHmtl);
		$("#tipPrice").css("color", "#1c86ee");
	});
	
	$("#txtPrice").live("focusout",function(){
		var maxSpeed = $("#txtPrice").val();
		if(maxSpeed == ""){
			$("#txtPrice").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>价格不能为空(只能是数字)";
			$("#tipPrice").html(warnHmtl);
			$("#tipPrice").css("color", "#f60");
		}else{
			$("#txtlinkMan").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipPrice").html(warnHtmlOk);
		}
	});
}

function initLinkPhone(){
	$("#txtlinkPhoneNum").live("focusin",function(){
		$("#txtlinkPhoneNum").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>联系电话是11位（座机请加上区号）";
		$("#tiplinkPhoneNum").html(warnHmtl);
		$("#tiplinkPhoneNum").css("color", "#1c86ee");
	});
	
	$("#txtlinkPhoneNum").live("focusout",function(){
		var maxSpeed = $("#txtlinkPhoneNum").val();
		if(maxSpeed == ""){
			$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话不能为空";
			$("#tiplinkPhoneNum").html(warnHmtl);
			$("#tiplinkPhoneNum").css("color", "#f60");
		}else if(maxSpeed.length != 11){
			$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话是11位（座机请加上区号）";
			$("#tiplinkPhoneNum").html(warnHmtl);
			$("#tiplinkPhoneNum").css("color", "#f60");
		}else{
			$("#txtlinkPhoneNum").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tiplinkPhoneNum").html(warnHtmlOk);
		}
	});
}

function initLinkMan(){
	$("#txtlinkMan").live("focusin",function(){
		$("#txtlinkMan").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>联系人尽量填写真实姓+先生/小姐(eg:张先生、张小姐)";
		$("#tiplinkMan").html(warnHmtl);
		$("#tiplinkMan").css("color", "#1c86ee");
	});
	
	$("#txtlinkMan").live("focusout",function(){
		var maxSpeed = $("#txtlinkMan").val();
		if(maxSpeed == ""){
			$("#txtlinkMan").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系人不能为空";
			$("#tiplinkMan").html(warnHmtl);
			$("#tiplinkMan").css("color", "#f60");
		}else{
			$("#txtlinkMan").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tiplinkMan").html(warnHtmlOk);
		}
	});
}

function initEvent(){
	$("#txtInfoTitle").live("focusin", function(){
		var warnHmtl = "<img src=\""+ctx+"/image/warn_icon.jpg\"/>信息标题不能超过50个字符";
		$("#tipInfoTitle").html(warnHmtl);
		$("#tipInfoTitle").css("color", "#1c86ee");
		$('#txtInfoTitle').css("border", "1px solid #ccc");
	});
	
	$("#txtInfoTitle").live("focusout", function(){
		var infoTitle = $("#txtInfoTitle").val();
		if(infoTitle == ""){
			var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>信息标题不能为空";
			$("#tipInfoTitle").html(warnHmtl);
			$("#tipInfoTitle").css("color",  "#f60");
			$('#txtInfoTitle').css("border", "1px solid #f60");
		}else if(infoTitle.length > 50){
			var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>信息标题长度不能超过50个字符";
			$("#tipInfoTitle").html(warnHmtl);
			$("#tipInfoTitle").css("color",  "#f60");
			$('#txtInfoTitle').css("border", "1px solid #f60");
		}else{
			$("#txtInfoTitle").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tipInfoTitle").html(warnHtmlOk);
		}
	});
	
	$("#txtRentDescrible").live("focusin", function(){
		var warnHmtl = "<img src=\""+ctx+"/image/warn_icon.jpg\"/>租车描述尽量详细";
		$("#tipRentDescrible").html(warnHmtl);
		$("#tipRentDescrible").css("color", "#1c86ee");
		$('#txtRentDescrible').css("border", "1px solid #ccc");
	});
	
	$("#txtRentDescrible").live("focusout", function(){
		var infoTitle = $("#txtRentDescrible").val();
		if(infoTitle == ""){
			var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>租车描述不能为空";
			$("#tipRentDescrible").html(warnHmtl);
			$("#tipRentDescrible").css("color",  "#f60");
			$('#txtRentDescrible').css("border", "1px solid #f60");
		}else{
			$("#txtRentDescrible").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tipRentDescrible").html(warnHtmlOk);
		}
	});
}

function initRentTypeEvent(){
	$("#rentType1").live("change",function(){
		if($("#rentType1").attr("checked") == "checked"){
			$("#rentType0").removeAttr("checked");
		}else{
			$("#rentType0").attr("checked", "checked");
		}
		
	});
	
	$("#rentType0").live("change",function(){
		if($("#rentType0").attr("checked") == "checked"){
			$("#rentType1").removeAttr("checked");
		}else{
			$("#rentType1").attr("checked", "checked");
		}
		
	});
}

function initVechileTypeEvent(){
	$("#vehcileType1").live("change",function(){
		if($("#vehcileType1").attr("checked") == "checked"){
			$("#vehcileType0").removeAttr("checked");
		}else{
			$("#vehcileType0").attr("checked", "checked");
		}
		
	});
	
	$("#vehcileType0").live("change",function(){
		if($("#vehcileType0").attr("checked") == "checked"){
			$("#vehcileType1").removeAttr("checked");
		}else{
			$("#vehcileType1").attr("checked", "checked");
		}
		
	});
}
function submitValidate(){
	var infoTitle = $("#txtInfoTitle").val();
	if(infoTitle == ""){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>信息标题不能为空";
		$("#tipInfoTitle").html(warnHmtl);
		$("#tipInfoTitle").css("color",  "#f60");
		$('#txtInfoTitle').css("border", "1px solid #f60");
		return false;
	}else if(infoTitle.length > 50){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>信息标题长度不能超过50个字符";
		$("#tipInfoTitle").html(warnHmtl);
		$("#tipInfoTitle").css("color",  "#f60");
		$('#txtInfoTitle').css("border", "1px solid #f60");
		return false;
	}
	
	var rentDesc = um.getContent();//$("#txtRentDescrible").val();
	if(rentDesc == ""){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>租车描述不能为空";
		$("#tipRentDescrible").html(warnHmtl);
		$("#tipRentDescrible").css("color",  "#f60");
		$('#txtRentDescrible').css("border", "1px solid #f60");
		return false;
	}
	
	var linkMan = $("#txtlinkMan").val();
	if(linkMan == ""){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>联系人不能为空";
		$("#tiplinkMan").html(warnHmtl);
		$("#tiplinkMan").css("color",  "#f60");
		$('#txtlinkMan').css("border", "1px solid #f60");
		return false;
	}
	
	var linkPhoneNum = $("#txtlinkPhoneNum").val();
	if(linkPhoneNum == ""){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>联系电话不能为空（11位）";
		$("#tiplinkPhoneNum").html(warnHmtl);
		$("#tiplinkPhoneNum").css("color",  "#f60");
		$('#txtlinkPhoneNum').css("border", "1px solid #f60");
		return false;
	}
	
	var price = $("#txtPrice").val();
	if(price == ""){
		var warnHmtl = "<img src=\""+ctx+"/image/verror.png\"/>价格不能为空（只能是数字）";
		$("#tipPrice").html(warnHmtl);
		$("#tipPrice").css("color",  "#f60");
		$('#txtPrice').css("border", "1px solid #f60");
		return false;
	}
	
	var province = $("#sel_Province option:selected").text();
	if(province == "--省份--"){
		$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
		$("#tipShopAddr").html(warnHmtl);
		return false;
	}
	
	var city = $("#sel_City option:selected").text();
	if(city == "--城市--"){
		$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择城市";
		$("#tipShopAddr").html(warnHmtl);
		return false;
	}		
		
	var attachAddr = $('#addressAttach').val();
	if(attachAddr == ""){
		$("#addressAttach").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请输入详细地址";
		$("#tipShopAddr").html(warnHmtl);
		return false;
	}
	
	var shopName = $('#txtShopName').val();
	if(shopName == ""){
		$("#txtShopName").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请输入店铺名称";
		$("#tipShopName").html(warnHmtl);
		return false;
	}
	return true;
}

function confirmAndSubmit(){
	if(submitValidate()){
		if(isLogin()){
			postMessage(getUserIdByUserName());
		}else{
			enterSecondStep();
		}
		
	}
}

//提交信息事件
function commerSubmit() {
	var userName = $("#email").val();
	var password = $("#passwordShow").val();
	
	//发登陆请求
	$.ajax({
		type: "post",
		dataType: "text",
		url: "u.do?type=10&userName="+userName+"&password="+password,
		success: function(v){
			if(v != ""){
				postMessage(v);
			}else{
				layer.alert("亲美美，用户名或者密码有误~~~", 2);
			}
		}
	}); 
}

function postMessage(v){
	var jsonData = getJsonData(v);
	$.ajax({
		type : "post",
		dataType : "text",
		contentType : "application/json",
		data : jsonData,
		url : ctx + "/rent.do?action=0",
		success : function(result) {
			if(result == "3"){
				layer.alert("亲美美，你今天已经发布了超过3条租车信息了,明天再发布吧~~~", 8);
			}else if(result == "1"){
				var imgIds = $("#hidImgIds").val();
				$.ajax({
					type : 'post',
					dataType : 'text',
					url : "img.do?action=6&imgIds="+imgIds+"&rentId="+$("#hidId").val(),
					success : function(data) {
						
					}
				});
				switchThirdStep();
			}else if(result = "2"){
				enterSecondStep();
				layer.alert("亲美美，请登录后再发布信息", 8);
			}else{
				layer.alert("亲美美，发布信息失败了", 8);
			}
			
		}
	});
}

function switchThirdStep(){
	$(".step1_img img").attr("src", "image/next_b.png");
	$(".step2_img img").attr("src", "image/next_b.png");
	$(".step3_img img").attr("src", "image/success.png");
	$(".step3_img img").attr("src", "image/next.png");
	$(".step3_img1 img").attr("src", "image/success.png");
	$(".step3_img1 img").css("display", "block");
	$("#div_email").css("display", "none");
	$("#div_info").hide();
	$("#div_success").css("display", "block"); 
}

function getUserIdByUserName(){
	var userId = "";
	var u = $.cookie("youleche.u");
	$.ajax({
		type : 'get',
		dataType : 'text',
		contentType : "application/json",
		url: "u.do?type=11&userName="+u,
		async: false,
		success: function(v){
			userId = v;
		}
	});
	
	return userId;
}

function enterSecondStep(){
	$(".step1_img img").attr("src", "image/next_b.png");
	$(".step2_img img").attr("src", "image/next.png");
	$("#div_info").css("display", "none");
	$("#div_email").css("display", "block"); 
}

function isLogin(){
	var result = false;
	$.ajax({
		type : 'post',
		dataType : 'text',
		contentType : "application/json",
		url: "login.do",
		success: function(v){
			if(v == "true"){
				result = true;
			}
		}
	}); 
	
	return result;
}
function getJsonData(releaseId){
	var rentInfo = new Object();
	rentInfo.rentId = $("#hidId").val();
	var infoTitle = $("#txtInfoTitle").val();	
	rentInfo.rentTitle = infoTitle;
	var rentDesc = um.getContent();//$("#txtRentDescrible").val();	
	rentInfo.rentDesc = rentDesc;
	var rentType = "0";
	if($("#rentType0").attr("checked") == "checked"){
		rentType == "0";
	}else{
		rentType == "1";
	}
	rentInfo.rentType = rentType;
	var vehicleType = "0";
	if($("#vehcileType1").attr("checked") == "checked"){
		vehicleType = "0";
	}else{
		vehicleType = "1";
	}
	rentInfo.vehicleType = vehicleType;
	var linkMan = $("#txtlinkMan").val();	
	rentInfo.linkMan = linkMan;
	var linkPhoneNum = $("#txtlinkPhoneNum").val();
	rentInfo.linkPhone = linkPhoneNum;
	var price = $("#txtPrice").val();
	rentInfo.rentPrice = price;
	var province = $("#sel_Province option:selected").text();	
	var city = $("#sel_City option:selected").text();		
	var attachAddr = $('#addressAttach').val();	
	var country = $("#sel_County option:selected").text();	
	if(country == "--区域--"){
		country = "";
	}
	rentInfo.rentAddress = province + city + country + attachAddr;
	rentInfo.A1 = province;
	rentInfo.A2 = city;
	var shopName = $('#txtShopName').val();
	rentInfo.shopName = shopName;
	rentInfo.releaseId = releaseId;
	var json = JSON.stringify(rentInfo);
	return json;
}

function teachMe(){
	var title = "美乐车自行车，九成新山地自行车，每天租车只需15元";
	var desc = "	美乐车租车，中国最大的自行车、电动车租车平台，我店拥有九成新的山地车，电动车，山地自行车租用15元每天，学生更有优惠，团租打8.8折。\n" +
			"	团租可以送自行车上门，取车也上门的服务，电动车每天租用只需25元每天，非人为损坏不用赔偿。如果自行车，电动车在途中损坏，我们将24小时上门进行服务。\n" +
			"	如果需要了解更多的信息，请联系美乐车客服。";
	$("#txtInfoTitle").val(title);
	$("#txtRentDescrible").val(desc);
	
	$("#txtRentDescrible").css("border", "#ccc 1px solid");
	var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
	$("#tipRentDescrible").html(warnHtmlOk);
	
	$("#txtInfoTitle").css("border", "#ccc 1px solid");
	var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
	$("#tipInfoTitle").html(warnHtmlOk);
}

function viewInfo(){
	var id = $("#hidId").val();
	window.location.href = "rent.do?action=1&id=" + id;
}